home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / stv.lha / STV / st_v / calend.cls < prev    next >
Text File  |  1993-07-23  |  1KB  |  55 lines

  1.  
  2. Inspector subclass: #CalendarInspector
  3.   instanceVariableNames: 
  4.     'dictionary instList selectedString '
  5.   classVariableNames: ''
  6.   poolDictionaries: '' !
  7.  
  8. !CalendarInspector class methods !
  9.  
  10. new
  11.           "Answer a new CalendarInspector."
  12.  
  13.           ^super new initialize! !
  14.  
  15.  
  16. !CalendarInspector methods !
  17.  
  18. accept: aString from: aDispatcher
  19.           "Set the text entered for a given date."
  20.  
  21.           dictionary at: selectedString put: aString.
  22.           ^true!
  23.  
  24. initialize
  25.           "Initialize the dictionary to hold text."
  26.  
  27.           dictionary := Dictionary new!
  28.  
  29. instance
  30.           "Return the text associated with the selected
  31.             date selectedString."
  32.  
  33.           ^ dictionary at: selectedString ifAbsent: [String new]!
  34.  
  35. instVarList
  36.     "Private - Answer an OrderedCollection of dates
  37.       for the list pane."
  38.  
  39.           ^ instList!
  40.  
  41. selectInstance: aString
  42.     "Private - the user selected this date."
  43.  
  44.           selectedString := aString.
  45.           self changed: #instance!
  46.  
  47. setInstList
  48.     "Private - Initialize an OrderedCollection of dates
  49.       in the year object."
  50.  
  51.     |firstDay|
  52.     firstDay := Date newDay: 1 year: object.
  53.     instList := OrderedCollection new.
  54.     0 to: (Date daysInYear: object) - 1 do: [ :i | instList add: (firstDay  addDays: i) printString]! !
  55.